#!/bin/bash  
variable=$(cat /home/pi/count)
#echo $variable
b=6
ONE=1
DATE=$(date)

#new=$(($variable + 1)) 
#echo $new > /home/pi/count



check ()
{

echo "This is a function";
echo;

 if [ "$variable" -gt "$ONE" ]; then
     echo  $variable

fi


}

if [ "$variable" -gt "$b" ]; then
    echo  "greater then"
    echo 0 >  /home/pi/count
    echo  "time to reboot"
    echo 1 > /home/pi/reboot_flag
    echo "Device Reboot $DATE"  >> /home/pi/lastReboot   
    sudo reboot
fi


check

